﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Campus.Entities;
using CampusSite.Models;
using CampusSite.ViewModels;
using MvcPaging;
using CampusSite.Security;

namespace CampusSite.Controllers
{
    
    [RolActionFilter]
    public class ListaBuenaFeController : Controller
    {
        
        private readonly IActividadRepository actividadRepository;
		private readonly IGrupoRepository grupoRepository;
        private readonly ITurnoRepository   turnoRepository;
        private readonly IDiaDeLaSemanaRepository diaDeLaSemanaRepository;
        private readonly IProfesorRepository profesorRepository;
        private readonly IEstudianteRepository estudianteRepository;


        CampusSiteContext context;
		// If you are using Dependency Injection, you can delete the following constructor
        //public GruposController() : this(new ActividadRepository(), new GrupoRepository(), new TurnoRepository(), new DiaDeLaSemanaRepository(), new ProfesorRepository())
        //{
        //}

        public ListaBuenaFeController()                           
        {

            ViewBag.ActiveMenu = "Grupos";

            context = new CampusSiteContext();
            this.actividadRepository = new ActividadRepository();
			this.grupoRepository = new GrupoRepository(context);
            this.turnoRepository = new TurnoRepository(context);
            this.diaDeLaSemanaRepository = new DiaDeLaSemanaRepository(context);
            this.profesorRepository = new ProfesorRepository(context);
            this.estudianteRepository = new EstudianteRepository(context);
            
        }
        
        public ListaBuenaFeController(IActividadRepository actividadRepository, IGrupoRepository grupoRepository, ITurnoRepository turnoRepository, IDiaDeLaSemanaRepository diaDeLaSemanaRepository, IProfesorRepository profesorRepository, IEstudianteRepository estudianteRepository)
        {
			this.actividadRepository = actividadRepository;
			this.grupoRepository = grupoRepository;
            this.turnoRepository = turnoRepository;
            this.diaDeLaSemanaRepository = diaDeLaSemanaRepository;
            this.profesorRepository = profesorRepository;
            this.estudianteRepository = estudianteRepository;            
        }
        
        //
        // GET: /ListaBuenaFe/
        [AllowAnonymous]
        public ActionResult Lista()
        {
            ViewBag.ActiveMenu = "ListaBuenaFe";
            //return Redirect("/WebHTML/Index.html");
            var grupos = grupoRepository.AllIncluding(g => g.Estudiantes).Where(g => g.EsListaBuenaFe == true).ToList();

            

            return View(grupos);
        }

    }
}
